fix: ignore Enter during IME composition in remaining text inputs#6575
fix: ignore Enter during IME composition in remaining text inputs#6575greymoth-jp wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces IME (Input Method Editor) composition checks across several dialogs and headers to prevent the 'Enter' key from prematurely triggering actions while a user is still composing text. The reviewer suggests also guarding the 'Escape' key handler in CanvasHeader with the same !isIMEComposition check to prevent closing the editing mode when a user cancels IME composition.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if (e.key === 'Enter' && !isIMEComposition) { | ||
| submitFlowName() | ||
| } else if (e.key === 'Escape') { | ||
| setEditingFlowName(false) |
There was a problem hiding this comment.
When typing with an IME, pressing the Escape key is often used to cancel or close the IME candidate list or composition window. If we do not guard the Escape key handler with !isIMEComposition, pressing Escape to cancel composition will bubble up and immediately close the editing mode, discarding the user's input.
We should apply the same !isIMEComposition guard to the Escape key check.
| if (e.key === 'Enter' && !isIMEComposition) { | |
| submitFlowName() | |
| } else if (e.key === 'Escape') { | |
| setEditingFlowName(false) | |
| if (e.key === 'Enter' && !isIMEComposition) { | |
| submitFlowName() | |
| } else if (e.key === 'Escape' && !isIMEComposition) { | |
| setEditingFlowName(false) |
What
ChatMessageandVectorStoreQueryalready skip their Enter handler while an IME is composing:A few other single-line text inputs handle Enter on keydown but don't have that check, so they act while the user is still composing.
Why
When typing with an IME (Japanese, Chinese, Korean, and macOS dead keys), the Enter that confirms a candidate fires a
keydownwithkey === 'Enter'(andkeyCode === 229/isComposing === true) beforecompositionend. Without a guard, that first confirmation Enter is treated as a submit, so:The result is that a CJK user cannot reliably type a multi-character word in these fields.
Change
Apply the same guard the repo already uses in
ChatMessageandVectorStoreQueryto the inputs that were missing it:views/canvas/CanvasHeader.jsx(flow name rename)ui-component/dialog/SaveChatflowDialog.jsx(save name)ui-component/dialog/TagDialog.jsx(add tag)ui-component/dialog/ExportAsTemplateDialog.jsx(add usecase)For a normal keystroke
isComposingisfalseandkeyCodeis13, so the guard is a no-op and existing behavior is unchanged. Escape handling is left as-is.Testing
I didn't have an IME set up to reproduce this directly. I confirmed the changed files build and that the guard expression is identical to the one already shipping in
ChatMessage/VectorStoreQuery. A manual check with a Japanese or Chinese IME in these four fields would be welcome to confirm.